package com.dht.xiao.jianye.dayin.util;

/**
 * Created by jsliang on 2016/9/27.
 */
public class HexUtil {
    private static char[] hexTable = {'0', '1', '2', '3', '4', '5', '6', '7',
            '8', '9', 'A', 'B', 'C', 'D', 'E','F'};

    public static String byte2HexString(byte data){
        StringBuilder hexString = new StringBuilder();
        int counter = 0;
        while (counter < 2){
            hexString.insert(0,hexTable[data & 0x0F]);
            data >>= 4;
            counter ++ ;
        }
        return hexString.toString();
    }
}
